home *** CD-ROM | disk | FTP | other *** search
/ Aminet 2 / Aminet AMIGA CDROM (1994)(Walnut Creek)[Feb 1994][W.O. 44790-1].iso / Aminet / dev / asm / TBSource.lha / SerialKeyBoard / SKS.S < prev   
Text File  |  1993-07-02  |  2KB  |  131 lines

  1. *************************************************
  2. *                        *
  3. *         (C)opyright 1993        *
  4. *                        *
  5. *        by  Tomi Blinnikka        *
  6. *                        *
  7. *    Don´t try to understand the code    *
  8. *                        *
  9. * Version 0.01     02/04/1993            *
  10. *     -0.99ö    -                *
  11. *                        *
  12. * BUGS:                        *
  13. *                        *
  14. *************************************************
  15.  
  16.     INCLUDE    "JMPLibs.i"
  17.     INCLUDE    "exec/types.i"
  18.     INCLUDE    "exec/nodes.i"
  19.     INCLUDE    "exec/lists.i"
  20.     INCLUDE    "exec/ports.i"
  21.     INCLUDE    "exec/memory.i"
  22.     INCLUDE    "exec/devices.i"
  23.     INCLUDE    "exec/io.i"
  24.     INCLUDE    "exec/tasks.i"
  25.     INCLUDE    "exec/interrupts.i"
  26.     INCLUDE    "libraries/dos.i"
  27.     INCLUDE    "devices/input.i"
  28.     INCLUDE    "devices/inputevent.i"
  29.  
  30. ;    INCLUDE    "XREF:intuition.xref"
  31.     INCLUDE    "XREF:exec.xref"
  32.     INCLUDE    "XREF:dos.xref"
  33.  
  34.         section    SerialKeyBoard,CODE
  35.  
  36.         oldlib    Dos,ShutDown
  37.  
  38. ;Open input.device
  39.  
  40.         lea.l    InputName,a0
  41.         move.l    #$00,d0
  42.         lea.l    IORequest,a1
  43.         move.l    #$00,d1
  44.         lib    Exec,OpenDevice
  45.         move.l    d0,IDev
  46.         bne    ShutDown
  47.  
  48. ;make a message port
  49.  
  50.         lea.l    MsgPort,a2
  51.         move.b    #NT_MSGPORT,LN_TYPE(a2)
  52.         clr.b    MP_FLAGS(a2)
  53.         clr.l    LN_NAME(a2)
  54.         move.l    #-1,d0
  55.         lib    Exec,AllocSignal
  56.         move.l    d0,SigBit1
  57.         bmi    ShutDown
  58.         move.b    d0,MP_SIGBIT(a2)
  59.  
  60. ;Find this task
  61.  
  62.         move.l    #$00,a1
  63.         lib    Exec,FindTask
  64.         move.l    d0,MP_SIGTASK(a2)
  65.         move.l    d0,OurTask
  66.  
  67.         lea.l    MP_MSGLIST(a2),a0
  68.         NEWLIST    a0
  69.         lea.l    IORequest,a1
  70.         move.l    a2,MN_REPLYPORT(a1)
  71.  
  72.         lea.l    IORequest,a1
  73.         move.w    #IND_WRITEEVENT,IO_COMMAND(a1)
  74.         lea.l    Event,a0
  75.         move.l    a0,IO_DATA(a1)
  76.         lib    Exec,DoIO
  77.         tst.l    d0
  78.         bne    ShutDown
  79.  
  80. MainLoop:    clr.l    d0
  81.         bset.l    #SIGBREAKB_CTRL_C,d0
  82.         lib    Exec,Wait
  83.  
  84.         cmp.l    #SIGBREAKF_CTRL_C,d0
  85.         beq    ShutDown
  86.         bra    MainLoop
  87.  
  88. ShutDown:
  89. ShutDown9000:    move.l    IDev,d0
  90.         bne    ShutDown8000
  91.         lea.l    IORequest,a1
  92.         lib    Exec,CloseDevice
  93.  
  94. ShutDown8000:    move.l    SigBit1,d0
  95.         bmi    ShutDown7900
  96.         lib    Exec,FreeSignal
  97.  
  98. ShutDown7900:
  99.  
  100. ShutDown7000:    closlib    Dos
  101.         clr.l    d0
  102.         rts
  103.  
  104. ;Structures
  105.  
  106.         libnames
  107.  
  108. ;Other stuff, part I
  109.  
  110. SigBit1:    dc.l    0
  111. OurTask:    dc.l    0
  112.  
  113. ;Devices
  114.  
  115. IDev:        dc.l    0
  116.  
  117. ;Strings, error
  118.  
  119. ;Strings, part I
  120.  
  121. VersionString:    dc.b    "$VER: SerialKeyBoard Server 0.11 (02.04.93) (C)opyright Tomi Blinnikka 1993",0
  122. InputName:    dc.b    "input.device",0
  123.         ds.l    0
  124.  
  125. ;Other stuff, part II
  126.  
  127. IOEvent:    dcb.b    IE_SIZE,0
  128. IORequest:    dcb.b    IO_SIZE,0
  129. MsgPort:    dcb.b    MP_SIZE,0
  130.         end
  131.